package com.atguigu.jxc.controller;


import com.atguigu.jxc.domain.ServiceVO;
import com.atguigu.jxc.service.GoodsTypeService;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RequestMapping("/goodsType")
@RestController
public class GoodsTypeController {

    @Autowired
    private GoodsTypeService goodsTypeService;

    @RequestMapping("/loadGoodsType")
    @RequiresPermissions(value = {"商品管理","进货入库","销售出库","客户退货","当前库存查询","商品报损","商品报溢","商品采购统计"},logical = Logical.OR)
    public String loadGoodsType(){
        return goodsTypeService.loadGoodsType();
    }

    @RequestMapping("/save")
    @RequiresPermissions(value={"商品管理","进货入库","退货出库","销售出库","客户退货","商品报损","商品报溢"},logical = Logical.OR)
    public ServiceVO save(String goodsTypeName, Integer pId){
        return goodsTypeService.save(goodsTypeName,pId);
    }

    @RequestMapping("/delete")
    @RequiresPermissions(value = {"商品管理","进货入库","退货出库","销售出库","客户退货","商品报损","商品报溢"},logical=Logical.OR)
    public ServiceVO delete(Integer goodsTypeId){
        return goodsTypeService.delete(goodsTypeId);
    }


}
